package com.test.idea;

import java.util.List;
import java.util.Optional;
import java.util.function.Function;

public class CustomerUtil {

    public String getChildId(Optional<Customer> customer){
        return customer.map(Customer::getChild).map(Customer::getId).orElse(null);
    }

    private List<String> data;

    public void run(){
        final Function<List<String>, String> prints = data -> "Data :" + data.toString();
        System.out.println(prints.apply(data));
    }

    public class Customer{

        private String id;

        public Customer getChild(){
            return new Customer();
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }
    }
}
